﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Threading.Tasks;
using Microsoft.AspNet.SignalR;

namespace Leiktuther.Controllers
{
    //	[Authorize]
    public class GameHub : Hub
    {
        public void Join(string groupId)
        {
            //			Context.User.Identity.Name
            // Context.QueryString

            Groups.Add(Context.ConnectionId, groupId);
        }

        public void ClickCell(string groupName, string cellId)
        {
            Clients.OthersInGroup(groupName).cellClicked(cellId);
            //			Clients.Others.cellClicked(cellId);
        }

        public void ClickCard(string clanName, string cardId)
        {
            Clients.OthersInGroup(clanName).cardClicked(cardId);
        }

        public void Send(string name, string message)
        {
            // Call the broadcastMessage method to update clients.
            Clients.All.broadcastMessage(name, message);
        }
    }
}